﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;
using System.Web.Caching;

public partial class DemoSqlDependency : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        SqlDataAdapter da = new SqlDataAdapter("select * from manufacturer", DataAccess.ConnectionString);
        DataSet ds = new DataSet();
        da.Fill(ds);
        SqlCacheDependency sqldp = new SqlCacheDependency("C1204M", "Manufacturer");
        if (Cache["Manufacturer"] == null)
        {
            Cache.Insert("Manufacturer", ds.Tables[0], sqldp, DateTime.Now.AddSeconds(60), TimeSpan.Zero);
            GridView1.DataSource = Cache["Manufacturer"];
            GridView1.DataBind();
        }

    }
}
